package net.tuandn.training.lesson.gson;

import net.tuandn.training.model.City;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class NullSupport {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		City saigon = new City(null, "Saigon", 6000000);

		Gson defaultSerializer = new Gson();
		System.out.println(defaultSerializer.toJson(saigon));

		Gson nullSupport = new GsonBuilder().serializeNulls().create();
		System.out.println(nullSupport.toJson(saigon));
	}

}
